﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProdTypeAtt.aspx.cs" Inherits="Com.CMS263.Web.manage.ProdAttr.ProdTypeAtt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>添加修改扩展属性</title>
    <link href="/manage/style/main.css" rel="stylesheet" type="text/css" />
    <link href="/manage/style/style.css" rel="Stylesheet" type="text/css" />
    <link href="/manage/common/validator.css" rel="stylesheet" type="text/css" />

    <script language="javascript" type="text/javascript" src="../../js/jquery-1.3.2.min.js"></script>

    <script language="javascript" type="text/javascript" src="../js/js_global.js"></script>

    <script language="javascript" type="text/javascript" src="../js/js_extlib.js"></script>

    <script language="javascript" type="text/javascript" src="../js/pager.js"></script>

    <style type="text/css">
        .style1
        {
            height: 394px;
        }
        #Spaattrv {
	display: block;
	float: right;
	width: 140px;
	position: relative;
	right: 20px;
	*top: -100px;
}

    </style>
    <script type="text/javascript" language="javascript">
        $(function() {
        $("#tab tbody tr").mouseover(function() {
        $("#tab tbody tr").attr("className", "asd02")
                $(this).attr("className", "asd01")
            })
        })
        function del(id, obj) {
                $.post("ProdAttAction.aspx?op=delprodatt", { id: id }, function(data) {
                    if (data == "ok") {
                        alert('删除成功');
                        $(obj.parentNode.parentNode).remove();
                    }
                    else {
                        alert("操作失败");
                    }
                })
            
        }
        function seldel(id, obj) {
            $.post("ProdAttAction.aspx?op=pcha", { id: id }, function(data) {
                if (data == "you") {
                    if (confirm('删除该商品类型，所属该商品的扩展属性和相关商品属性都将被删除，这是一个不可逆的操作请妥善进行，您真的要删除此条记录？')) {
                        del(id, obj);
                    }
                }
                if (data == "wu") {
                    if (confirm('这是一个不可逆的操作，真的要删除此条记录')) {
                        del(id, obj);
                    }
                }
            })
        }
        function editItem(id, ptid, page) {
            window.location.href = "EditProdAttr.aspx?ptid="+ptid+"&id="+id+"&page="+page;
        }
        function sel(obj) {
            var ssel = $(obj).attr("value")
            if (ssel >= 6 && ssel <= 8) {

                $("#kxz").show();
            }
            else {

                $("#kxz").hide();
            }
        }
        function changeNull(id) {
            var flag = $("#hi" + id).val();
            $.post("ProdAttAction.aspx?op=chnull&code=" + Math.random(1000), { id: id, flag: flag }, function(data) {

                if (data == "yes") {
                    $("#img" + id).attr("src", "/manage/images/yes.png");
                    $("#hi" + id).val("1");
                }
                else {
                    $("#img" + id).attr("src", "/manage/images/no.png");
                    $("#hi" + id).val("0");
                }
            })
        }
        function changeBack(id) {
            var flag = $("#hiback" + id).val();
            $.post("ProdAttAction.aspx?op=chback&code=" + Math.random(1000), { id: id, flag: flag }, function(data) {

                if (data == "yes") {
                    $("#imgback" + id).attr("src", "/manage/images/yes.png");
                    $("#hiback" + id).val("1");
                }
                else {
                    $("#imgback" + id).attr("src", "/manage/images/no.png");
                    $("#hiback" + id).val("0");
                }
            })
        }
    </script>
</head>
<body style="background-color: #ffffff;">
    <form id="form1" runat="server" enctype="multipart/form-data">
    <div>
        <table border="0" cellspacing="0" cellpadding="0" class="dstable" style ="background-color:#ffffff;">
            <tr>
                <td height="23" class="table_2">
                    <asp:Label ID="lbTypeName" runat="server"></asp:Label>
                    管理
                </td>
            </tr>
            <tr>
                <td class="tdside" align="left">
                </td>
            </tr>
            <tr>
                <td>
                    <table id="tab" border="0" cellspacing="0" cellpadding="0" class="n_dstable">
                        <thead class="data_th">
                            <tr style="text-align: center">
                                <td>
                                    编号
                                </td>
                                <td>
                                    属性中文名
                                </td>
                                <td>
                                    属性名
                                </td>
                                <td>
                                    属性类型
                                </td>
                                
                                <td>
                                    可选择值
                                </td>
                                <td>
                                    不能为空
                                </td>
                                <td>
                                    后台列表显示
                                </td>
                                <td>
                                    默认值
                                </td>
                                <td>操作</td>
                            </tr>
                        </thead>
                        <tbody class="data_tb">
                        <% foreach (Com.CMS263.PO.ProdAttribute pa in plist)
                           {%>
                               <tr   style="text-align: center">
                                <td>
                                    <%=pa.Id %>
                                </td>
                                <td>
                                    <%=pa.AttrName %>
                                </td>
                                <td>
                                    <%=pa.AttrEnName %>
                                </td>
                                <td>
                                    <%=GetTypeValue(pa.AttrType)%>
                                </td>
                               
                                <td>
                                    <%=pa.AttrValue %>
                                </td>
                                 <td>
                                <input type="hidden" id="hi<%=pa.Id %>" name="hi<%=pa.Id %>" value='<%=Convert.ToInt32(pa.IsNull) %>' />
                                    <a style="cursor: pointer">
                                        <img id="img<%=pa.Id %>" onclick='changeNull(<%=pa.Id %>)' src='/manage/images/<%=pa.IsNull==true?"yes.png":"no.png"%>' /></a>
                                    
                                </td>
                                <td>
                                <input type="hidden" id="hiback<%=pa.Id %>" name="hiback<%=pa.Id %>" value='<%=Convert.ToInt32(pa.IsBackShow) %>' />
                                    <a style="cursor: pointer">
                                        <img id="imgback<%=pa.Id %>" onclick='changeBack(<%=pa.Id %>)' src='/manage/images/<%=pa.IsBackShow==true?"yes.png":"no.png"%>' /></a>
                                   
                                </td>
                                <td>
                                    <%=pa.DefaultValue %>
                                </td>
                                 <td >
                                    <input type="button" class="btn4_out" onmouseover="this.className='btn4_over'" onmouseout="this.className='btn4_out'"
                                        onclick='editItem(<%=pa.Id %>,<%=pa.ProdTypeId %>,<%=Convert.ToInt32(Request["page"]) %>)' value="编辑" />
                                    &nbsp;&nbsp;<input type="button" class="btn4_out" onmouseover="this.className='btn4_over'"
                                        onmouseout="this.className='btn4_out'" onclick="del(<%=pa.Id %>,this)" value="删除" />&nbsp;&nbsp;
                                </td>
                            </tr>
                           <%} %>
                            
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                </td>
            </tr>
        </table>
        <table border="0" style="width:70%"  cellspacing="0" cellpadding="0" class="dstable">
            <tr>
                <td height="23" class="table_2">
                    添加/修改 扩展属性
                </td>
            </tr>
            <tr>
                <td class="tdside" align="left">
                </td>
            </tr>
            <tr>
                <td>
                    <table border="0" cellspacing="0" cellpadding="0" class="n_dstable">
                        
                        <tbody  class="data_tb">
                        <tr style="text-align: left">
                                <td class="qian" >
                                    类型名称
                                </td>
                                <td>
                                    <asp:HiddenField ID="hfId" Value="0" runat="server" />
                                    <asp:Label ID="lblTypeName" runat="server" ></asp:Label>
                                    <asp:HiddenField ID="hfptid" Value="0" runat="server" />
                                    
                                </td>
                                
                            </tr>
                            <tr style="text-align: left">
                                <td class="qian" >
                                    属性中文名
                                </td>
                                <td>
                                    <asp:TextBox ID="txtAttrName" CssClass="input_text" Width="300px"  runat="server" ></asp:TextBox>
                                </td>
                                
                            </tr>
                            <tr  style="text-align: left">
                                <td class="qian" >
                                    属性名
                                </td>
                                <td>
                                   <asp:TextBox ID="txtAttrEnName" CssClass="input_text" Width="300px"  runat="server" ></asp:TextBox>
                                </td>
                                
                            </tr>
                            <tr  style="text-align: left">
                                <td  class="qian"  >
                                    属性类型
                                </td>
                                <td style="text-align: left" >
                                
                                <select name="ddlType" id="ddlType"  onchange="sel(this)"  style=" text-align:center">
                                <option value ="0">请选择...</option>
                              <option value ="1">单行文本框</option>
                              <option value ="2">多行文本框</option>
                              <option value ="3">在线编辑器</option>
                               <option value ="4">上传图片</option>
                              <option value ="5">上传文件</option>
                              <option value ="6">单选框</option>
                              <option value ="7">多选框</option>
                               <option value ="8">下拉框</option>
                            </select> <span style ="color :Red; text-align:left;" >单选框、多选框、下拉框需在可选值列表输入值</span>
                                   
                                </td>
                                
                                
                            </tr>
                            <tr id="kxz"  style="text-align: left; display :none ">
                                <td class="qian"   >
                                    可选值列表
                                </td>
                                   <td style=" text-align:left"><textarea    id="txtAttrValue" name ="txtAttrValue" cols="20"  rows="2" ></textarea>
                                   <span id="Spaattrv" style ="color :Red; text-align:left; vertical-align:top;">内容回车<br />分开例如：<br />白色<br />红的<br />黄色</span></td>
                                
                            </tr>
                            <tr  style="text-align: left">
                                <td class="qian" >
                                    不能为空
                                </td>
                                <td>
                                    <asp:CheckBox ID="chbIsNull" runat="server"  /> 
                                </td>
                                
                            </tr>
                            <tr  style="text-align: left">
                                <td class="qian" >
                                    后台列表显示
                                </td>
                                <td>
                                   <asp:CheckBox ID="chbShowBack" runat="server" /> 
                                </td>
                                
                            </tr>
                            <tr  style="text-align: left">
                                <td class="qian" >
                                    默认值
                                </td>
                                <td>
                                   <asp:TextBox ID="txtDefaultValue" Width="300px"  CssClass="input_text" runat="server" ></asp:TextBox>
                                </td>
                                
                            </tr>
                            <tr  style="text-align: left">
                                <td class="qian" colspan="2" >
                                    <asp:Button ID="btnSubmit" CssClass="btn4_out"  onmouseover="this.className='btn4_over'" onmouseout="this.className='btn4_out'" runat="server" Text="提交" onclick="btnSubmit_Click" /> &nbsp;&nbsp;
                                    <asp:Button ID="btnBack" CssClass="btn4_out"  
                                        onmouseover="this.className='btn4_over'" onmouseout="this.className='btn4_out'" 
                                        runat="server" Text="返回" onclick="btnBack_Click"  /> &nbsp;&nbsp;
                                </td>
                            </tr>
                        </tbody>
                        
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
